<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>忘记密码</title>
<link rel="stylesheet" href="<%=path%>/css/bootstrap.min.css" />
<link rel="stylesheet" href="<%=path%>/css/easyui.css" />
<!-- <link rel="stylesheet"
	href="https://cdn.bootcss.com/bootstrap/4.1.0/css/bootstrap.min.css"> -->
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/popper.js/1.12.5/umd/popper.min.js"></script>
<script
	src="https://cdn.bootcss.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<style>
body {
	background-color: #f1f1f1;
}

.lightBg {
	background-color: #fff;
	padding: 10px 20px;
}

.registBody {
	padding: 10px 20px;
}

#danwei, #geren {
	margin-top: 40px;
}
</style>
</head>

<script type="text/javascript">
	function agree() {
		var check = document.getElementsByTagName('input')[0];
		console.log(check.checked);
		if (!check.checked) {
			$("#next").attr("disabled", true);
		} else {
			$("#next").attr("disabled", false);
		}
	}

	function next() {
		$("#nextt").attr("disabled", false);
	}
</script>

<body>

	<div class="container">
		<div class="row lightBg">
			<!--标题-->
			<h2 class="pull-left">
				<img src="<%=path%>/images/logo.png" style="width: 80px;">
				智游科技项目申报系统
			</h2>
			<p class="pull-right" style="margin-top: 20px;">
				<a href="<%=path%>/news/toIndex2" class="btn btn-warning">返回首页</a>
			</p>
		</div>
		<div class="row" style="margin-top: 20px;">
			<div class="panel panel-info">
				<div class="panel-heading">找回密码</div>
				<div class="panel-body">
					<div class="registBody">
						<p>
							<strong>请根据您的工作职责，选择相应的身份进行密码找回：</strong>
						</p>
						<ul class="nav nav-tabs nav-justified">
							<li role="presentation" class="active" id="dtab"><a href="#"><img
									src="<%=path%>/images/icon01.gif">
									<div>项目负责人</div></a></li>
							<li role="presentation" class="" id="gtab"><a href="#"><img
									src="<%=path%>/images/icon02.gif">
									<div>项目申报单位</div></a></li>
						</ul>
						<div id="danwei">
							<p>您当前选择的身份是：项目负责人</p>
							<p>角色对应职能：</p>
							<ol>
								<li>对本单位的项目进行管理；</li>
								<li>向所属申报单位体检申报的项目信息；</li>
							</ol>
							<button type="button" class="btn btn-primary" data-toggle="modal"
								data-target="#myModal1">找回密码</button>
						</div>
						<div id="geren" class="hidden">
							<p>您当前选择的身份是：申报单位</p>
							<p>角色对应职能：</p>
							<ol>
								<li>注册单位用户名，维护单位信息，管理本单位的项目申报人；</li>
								<li>对本单位所申报的项目进行管理和审核；</li>
								<li>向成都市相应管理部门提交本单位所申报的项目；</li>
							</ol>
							<button type="button" class="btn btn-primary" data-toggle="modal"
								data-target="#myModal2">找回密码</button>
						</div>
					</div>
				</div>
			</div>
		</div>
		<footer style="margin-top:40px;">
			<p class="text-center">版权归智游教育所有</p>
		</footer>
	</div>

	<div class="modal fade" id="myModal1">
		<div class="modal-dialog">
			<div class="modal-content">

				<!-- 模态框头部 -->
				<div class="modal-header">
					<h4 class="modal-title">项目负责人找回密码</h4>
					<button type="button" class="close" data-dismiss="modal">&times;</button>
				</div>

				<div class="modal-body">
					<table cellpadding="5">
						<tr>
							<td>账号:<input type="text" id="lid1"></td>
							<td>姓名:<input type="text" id="name"></td>
						</tr>
						<tr>
							<td>身份证号码:<input type="text" id="no"></td>
							<td>新密码:<input type="text" id="pwd1"></td>
						</tr>
					</table>
				</div>

				<!-- 模态框底部 -->
				<div class="modal-footer">
					<button class="btn btn-primary" onclick="forget1()"
						disabled="disabled" id="sub1">提交</button>
					<button type="button" id="aa" class="btn btn-secondary"
						data-dismiss="modal">关闭</button>
				</div>
			</div>
		</div>
	</div>
	<div class="modal fade" id="myModal2">
		<div class="modal-dialog">
			<div class="modal-content">

				<!-- 模态框头部 -->
				<div class="modal-header">
					<h4 class="modal-title">单位找回密码</h4>
					<button type="button" class="close" data-dismiss="modal">&times;</button>
				</div>

				<!-- 模态框主体 -->
				<form action="">
					<div class="modal-body">
						<table>
							<tr>
								<td>单位名称:<input type="text" id="cname"></td>
								<td>单位机构码:<input type="text" id="lid2"></td>
							</tr>
							<tr>
								<td colspan="2" align="center">新密码:<input type="text"
									id="pwd2"></td>
							</tr>
						</table>
					</div>

					<!-- 模态框底部 -->
					<div class="modal-footer">
						<button class="btn btn-primary" onclick="forget2()"
							disabled="disabled" id="sub2">提交</button>
						<button type="button" class="btn btn-secondary"
							data-dismiss="modal">关闭</button>
					</div>
				</form>

			</div>
		</div>
	</div>

	<script src="<%=path%>/js/jquery1.12.4.min.js"></script>
	<script src="<%=path%>/js/bootstrap.min.js"></script>
	<script src="<%=path%>/js/jquery.easyui.min.js"></script>
	<script src="<%=path%>/js/jquery-3.3.1.js"></script>
	<script type="text/javascript">
		$(function() {
			$('#dtab').click(function() {
				if (!$(this).hasClass('active')) {
					$('#gtab').removeClass('active');
					$('#geren').addClass('hidden');
					$('#dtab').addClass('active');
					$('#danwei').removeClass('hidden');
				}
			});
	
			$('#pwd1').blur(function() {
				var p1 = $('#pwd1').val()
				if (p1.length >= 8 && p1.length <= 16) {
					$("#sub1").attr("disabled", false);
				} else {
					alert("密码格式错误")
				}
			})
			$('#pwd2').blur(function() {
				var p2 = $('#pwd2').val()
				if (p2.length >= 8 && p2.length <= 16) {
					$("#sub2").attr("disabled", false);
				} else {
					alert("密码格式错误")
				}
			})
	
			$('#gtab').click(function() {
				if (!$(this).hasClass('active')) {
					$('#dtab').removeClass('active');
					$('#danwei').addClass('hidden');
					$('#gtab').addClass('active');
					$('#geren').removeClass('hidden');
				}
			});
		});
		function forget1() {
			$.ajax({
				type : "POST",
				dataType : "json",
				url : "<%=path%>/user/forgetUser?lid=" + $('#lid1').val() + "&name=" + $('#name').val() + "&no=" + $('#no').val() + "&pwd1=" + $('#pwd1').val(),
				success : function(result) {
					if (result == '200') {
						alert('修改成功');
					} else if (result == '400') {
						alert('请核对信息是否存在错误!')
					} else {
						alert("未查询到此账户")
					}
				}
			});
		}
		function forget2() {
			$.ajax({
				type : "POST",
				dataType : "json",
				url : "<%=path%>/user/forgetCom?lid=" + $('#lid2').val() + "&cname=" + $('#cname').val() + "&pwd2=" + $('#pwd2').val(),
				success : function(result) {
					if (result == '200') {
						alert('修改成功');
					} else if (result == '400') {
						alert('请核对信息是否存在错误!')
					} else {
						alert("未查询到此账户")
					}
				}
			});
		}
	</script>
</body>
</html>